package cn.yanhu.kuwanapp.my.adapter

import cn.woochen.comlib.adapter.CommonRecyclerAdapter
import cn.woochen.comlib.util.ext.setOnSingleClickListener
import cn.yanhu.kuwanapp.R
import cn.yanhu.kuwanapp.bean.other.WithdrawMethodBean
import cn.yanhu.kuwanapp.databinding.ItemWithdrawMethodBinding

class WithdrawMethodAdapter constructor(datas: List<WithdrawMethodBean>) :
    CommonRecyclerAdapter<WithdrawMethodBean>(
        datas, R.layout.item_withdraw_method
    ) {

    var mOperateListener:OperateListener? = null

    interface OperateListener {
        fun bindPayMethod(position: Int)
    }

    override fun convert(holder: ViewHolder, item: WithdrawMethodBean) {
        holder.getDataBinding<ItemWithdrawMethodBinding?>()?.let {
            it.itemInfo = item
            it.ivSelect.isSelected = item.select
            it.tvBind.setOnSingleClickListener {
                mOperateListener?.bindPayMethod(holder.adapterPosition)
            }
        }
    }
}